<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class CartBuyRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
//    public function authorize()
//    {
//        return false;
//    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //
            'name' => 'required',
            'phone' => 'required|regex:/^1[345789][0-9]{9}$/',
            'address' => 'required',
            'products' => 'required',
            'paypass' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => retStrInfo(202),
            'phone.required' => retStrInfo(202),
            'phone.regex' => retStrInfo(205),
            'products.required' => retStrInfo(202),
            'paypass.required' => retStrInfo(202),
        ];
    }
}
